package com.macro.mall.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum AccountStateEnum {
    OK( (byte)1, "正常"),

    NO( (byte)2, "拉黑");


    private final Byte codeNum;

    private final String title;



    public static AccountStateEnum of(Byte code) {
        for (AccountStateEnum identityEnum : AccountStateEnum.values()){
            if(identityEnum.codeNum.equals(code)){
                return identityEnum;
            }
        }
        return NO;
    }

    public static String getTitle(Byte code){
        return of(code).title;
    }

}
